package com.lxw.oa.mapper;

import com.lxw.oa.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;

public interface UserMapper {
    @Select("select * from sys_oa_user where name=#{name} and password=#{password}")
    List<User> getUser(User user);

    @Select("select * from sys_oa_user where name=#{name}")
    List<User> findUserByName(String name);

    @Update("update sys_oa_user set identity=#{identity} where id=#{id}")
    void updateUserRole(User user);

    @Insert("insert into sys_user_img (username,imgbase) values(#{userName},#{image})")
    void userImgAdd(@Param("image")String image, @Param("userName")String userName);

    @Delete("delete from sys_user_img where username=#{userName}")
    void userImgDel(String userName);

    @Select("select imgbase from sys_user_img where username=#{userName}")
    List<String> userImgGet(String userName);

    @Insert("insert into sys_user_imgs (create_user,base_img,create_time,mark) values(#{userName},#{image},#{dateString},#{mark})")
    void userImgsAdd(@Param("userName")String userName,@Param("image")String image, @Param("dateString")String dateString, @Param("mark")String mark);

    @Select("select base_img from sys_user_imgs order by create_time desc")
    List<String> userImgsGet();

    @Select("select xh,xm,rxrq,xb,mz,nj,syd,xz,ssxb,sylx from app_xsfk_xsjbxxb where xh =#{name}")
    List<HashMap> getInformation(String name);
}
